<?php
include 'includes/cPage.php';
include 'includes/cDatabase.php';
include 'includes/variables.php';
include 'includes/cPlayer.php';
include 'includes/cMember.php';
include 'includes/cGame.php';
include 'includes/cTransfer.php';
include 'includes/cDates.php';
include 'includes/cInjury.php';

$cPage = new page("Injured Players");
echo $cPage->getTitle();
echo $cPage->pageStringStart();
echo $cPage->contentStringStart();

$proxy_name="137.58.62.9";
$proxy_port=8080;
$url = "http://www.physioroom.com/news/english_premier_league/epl_injury_table.php";

for ($i = 0; $i < 20; $i++)
{
	$teamInjury[$i] = new injury();
}

$count = preadfilet($url, $proxy_name, $proxy_port);

// Search from
// <div class="mvb">
// to 
// <!-- E IINC -->
	
$offset = 0;		
			
function preadfilet($_url, $_proxy_name, $_proxy_port)
{ 
    $proxy_cont = '';	// Storage area for file contents

    $proxy_fp = pfopent($_url, $_proxy_name, $_proxy_port); 
    while(!feof($proxy_fp)) 
	{
		$proxy_cont .= fread($proxy_fp,4096);
	} 
    fclose($proxy_fp); 

	//$start = strpos($proxy_cont,"Reported English");
	$start = strpos($proxy_cont,"<div id=\"inta_new_wrap\">");
	//$end = strpos($proxy_cont,"http://www.physioroom.com/news/english_premier_league/syndicates")-25;
	$end = strpos($proxy_cont,"</table></div>") + 15;

	$length = $end - $start;

	$proxy_cont = substr($proxy_cont, $start, $length);
    echo $proxy_cont;

    return count($proxy_cont); 
} 

function pfopent($_url, $_proxy_name, $_proxy_port) 
{ 
    $proxy_fp = fsockopen($_proxy_name, $_proxy_port); 
    if (!$proxy_fp)
	{
		return false;
	}
    $host= substr($_url, 7); 
    $host = substr($bucket, 0, strpos($host, "/")); 

    $request = "GET $_url HTTP/1.0\r\nHost:$host\r\n\r\n"; 

    fputs($proxy_fp, $request); 

    return $proxy_fp;  
}

echo $cPage->getContentStringEnd();
echo $cPage->getMenu();
echo $cPage->getClear();
echo $cPage->pageStringEnd();
echo $cPage->getFooter();
?>